<%@ page contentType="text/html; charset=utf-8" language="java" errorPage="" %>
<%@ page import="javax.naming.Context"%> 
<%@ page import="javax.sql.DataSource"%> 
<%@ page import="javax.naming.InitialContext"%> 
<%@ page import="java.sql.*"%> 
<%@page import="dataconn.DbWrapper;"%> 
<%
request.setCharacterEncoding("utf-8");
String UserName=request.getParameter("UserName");
String Password=request.getParameter("Password");
String RealName=request.getParameter("RealName");
String Email=request.getParameter("Email");
String sql="select count(*) from TestUser where UserName='"+UserName+"'";
int count=DbWrapper.nCount(sql);
if(count>0)
{
out.print("<br>该用户已经存在！<br>");
out.print("<a href='AddUser.jsp'>重新添加</a>");
return;}

sql="insert into TestUser(UserName,Password,RealName,Email,UserLevel) values('"+UserName+"','"+Password+"','"+RealName+"','"+Email+"','1')";
DbWrapper.executeUpdate(sql);
response.sendRedirect("AddUser.jsp");
%> 